package com.ruoyi.jjyh.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.EmptyUtils;
import com.ruoyi.jjyh.domain.JjyhGoodsclass;
import com.ruoyi.jjyh.service.IJjyhGoodsclassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 商品分类Controller
 * 
 * @author ruoyi
 * @date 2020-11-19
 */
@Controller
@RequestMapping("/phone/jjyh/goodsclass")
public class JjyhGoodsclassPhoneController extends BaseController {


    @Autowired
    private IJjyhGoodsclassService jjyhGoodsclassService;


    /**
     * 获取商品分类
     * @param pid
     * @return
     */
    @RequestMapping("/getGoodsClass")
    @ResponseBody
    public AjaxResult getGoodsClass(String pid){
        JjyhGoodsclass goodsclass = new JjyhGoodsclass();
        if(EmptyUtils.isNotEmpty(pid)){
            goodsclass.setPid(pid);
        }else {
            goodsclass.setClassLevel("一级");
        }
        return success("获取成功", jjyhGoodsclassService.selectJjyhGoodsclassList(goodsclass));

    }

}
